1
1
.
.
4
4
.
.
2
2
j
j
a
a
v
v
a
a
.
.
e
e
x
x
e
e
I
I
n
n
f
f
o
o
java.exe is used to start JVM and run .class files in it.
Examples
COMMAND
DESCRIPTION
java Test
Run Test.class in current Directory (PATH Environment Variable is used)
java begin.middle.Test
Run Test.class in begin\middle Subdirectory
C:\Install\JDK14\bin\java Test
Specify full path to java.exe (PATH Environment Variable is ignored)
java Test "John" 20
Run Test.class with two Input Parameters
java -cp .;D:\Test\MyClasses Test
Look for Classes in current and full path directory
java Test > my.log
Output of will be written to the file (instead of Console)
Errors
'java' is not recognized as an internal or external command
java.exe: NoClassDefFoundError
java.exe: My.jar access denied
java.exe: My.jar cannot execute binary file
R
R
e
e
f
f
e
e
r
r
e
e
n
n
c
c
e
e
j
j
a
a
v
v
a
a
.
.
e
e
x
x
e
e
When referencing java.exe PATH Environment Variable will be used to locate it if full path is not given.
Examples
COMMAND
DESCRIPTION
java Test
PATH Environment Variable will be used to locate java.exe
C:\Install\JDK14\bin\java Test
Specify full path to java.exe (PATH Environment Variable is ignored)
I
I
n
n
p
p
u
u
t
t
P
P
a
a
r
r
a
a
m
m
e
e
t
t
e
e
r
r
s
s
Java Console Application can be executed by providing optional Input Parameters.
Examples
COMMAND
DESCRIPTION
java Test
No Input Parameters
java Test "John" 20
Two Input Parameters
O
O
u
u
t
t
p
p
u
u
t
t
Output of program will be written to the file
Examples
COMMAND
DESCRIPTION
java Test
Output is written to the Console
java Test > ivor.log
Output is written to the File ivor.log (it will be created in current Directory)
-
-
v
v
e
e
r
r
s
s
i
i
o
o
n
n
Displays JAVA version.
Examples
COMMAND
DESCRIPTION
java -version
Display version of java.exe
-
-
h
h
e
e
l
l
p
p
Displays possible parameters and their usage.
Examples
COMMAND
DESCRIPTION
java -help
Display possible parameters of java.exe
-
-
c
c
l
l
a
a
s
s
s
s
p
p
a
a
t
t
h
h
,
,
-
-
c
c
p
p
Defines where to look for class files needed to run application.
You can define directories, JAR or ZIP files.
Examples
COMMAND
DESCRIPTION
java -classpath classes Test2.java
Look for class files in classes dir in current directory.
java -classpath .;..\classes;C:\stuff Test2.java
Look for class files in listed directories.
java -cp servlet.jar;C:\util.zip Test2.java
Look for class files in listed JAR and ZIP files.